import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', () => {
    const token = ref('')
    const userInfo = ref({})
    const login = () => {

    }
    const logout = () => {
        return new Promise<void>((resolve, reject) => {
            localStorage.setItem('token', "");
            location.reload(); // 清空路由
            resolve();
        });
    }
    return {
        token,
        userInfo,
        login,
        logout
    }
})